<?php
namespace app\api\controller;


use app\api\model\UserChannel;
use app\api\service\Bank;
use app\api\service\CashServiceJft;
use app\api\service\CashServiceYlys;
use think\Cache;
use think\Session;
use Houdunwang\WeChat\WeChat;
class Test extends \think\Controller
{
    public function cashj(){
        $jft = new CashServiceJft();
        $yy = new CashServiceYlys();
        $data['user_id'] = 2;
        $data['realname'] = '蒙苗苗';
        $data['meraddress'] = '西矿街南寒巷189号';
        $data['certno'] = '452231198308050061';
        $data['tobankno'] = '6222020502006262310';
        $data['tophoneno'] = '13803458507';
        $data['bankcode'] = '102161000357';
        print_r($jft->register($data));
    }
    public function test(){
//        $bank = new Bank();
//        $bank->register([]);
        $model = new UserChannel();
        $data = [
            'user_id' => 12,
            'channel_id' => 13,
            'merchantno' => '',
            'realname' => 'wangzi',
            'certno' => '142602918401101510',
            'bankname' => 'zgyh',
            'bankno' => '11110111110',
            'accno' => '388828289328934824',
            'phoneno' => '13666666666',
            'province_id' => 11,
            'city_id' => 12,
            'notes' => '',
            'status' => 0,
        ];
        echo $model->insertData($data);
    }
//获取用户的openid
    public function wxtext(){
        //微信配置
        $config =  [
            /*
            |--------------------------------------------------------------------------
            | 公众号身份标识
            |--------------------------------------------------------------------------
            | 填写公众号认证后腾讯官网发来的邮件中的appid
            */
            'appid'          => 'wx75d71ce2c90bfa00',
            'cache_path'     => RUNTIME_PATH.'/houdunren/wechat',
            /*
            |--------------------------------------------------------------------------
            | appsecret
            |--------------------------------------------------------------------------
            | 公众平台API的权限获取所需密钥Key
            | 需要与微信公众号后台保持一致
            */
            'appsecret'      => 'c86a734135d19bb2cb7d29ae13f26734',

        ];
        (new WeChat)->config($config);
        $res = WeChat::instance('oauth')->snsapiUserinfo();
        if (isset($res['openid'])) {
            echo "昵称: {$res['nickname']} openid:{$res['openid']}";
        } else {
            echo '获取粉丝OPENID失败';
        }
    }

    public function callback(){

    }

}